/////////////////////////khd
var map = new BMapGL.Map("allmap");
            var point = new BMapGL.Point(116.331398,39.897445);
            map.centerAndZoom(point,12);
            var geolocation = new BMapGL.Geolocation();
            geolocation.getCurrentPosition(function(r){
                if(this.getStatus() == BMAP_STATUS_SUCCESS){
                    var mk = new BMapGL.Marker(r.point);
                    map.addOverlay(mk);
                    map.panTo(r.point);
                    //alert('[客户端定位]您的位置：' + r.point.lng + ',' + r.point.lat);
    
    
                    //逆地址解析
                    //var map = new BMapGL.Map("container");      
                    //map.centerAndZoom(new BMapGL.Point(116.404, 39.915), 11);      
                    // 创建地理编码实例      
                    var myGeo = new BMapGL.Geocoder();      
                    // 根据坐标得到地址描述    
                    myGeo.getLocation(new BMapGL.Point(r.point.lng, r.point.lat), function(result){      
                        if (result){      
                        //alert(result.address);
                        //alert('[客户端定位]您的位置：' +result.address+" "+ r.point.lng + ',' + r.point.lat);
                        document.getElementById("khd").innerHTML='客户端: '+result.address+" BDS"+ r.point.lng + ',' + r.point.lat
                        userKhd = result.address
                        console.log("浏览器定位结果：")
                        console.log(r.point.lng+" "+ r.point.lat)
                        console.log(result.address)      
                        }      
                    });
    
    
                }
                /*
                else {
                    alert('failed' + this.getStatus());
                }  */       
            }); 



        
////////////////////////ip

            
            function myFun(result){
                console.log("打印result")
                console.log(result)
                var cityName = result.name;
                map.setCenter(cityName);
                //alert("[ip定位]您的ip属地:" + cityName);
                document.getElementById("ip").innerHTML='ip属地: ' + cityName
                userIp = cityName
                console.log("ip地址：")
                console.log(cityName)
            }
            var myCity = new BMapGL.LocalCity();
            myCity.get(myFun);




